<?php
session_start();

$text = $_SESSION['key'];

$image = imagecreate(80, 20);
$font = "arialbd.ttf";
$maxTextSize = 11;
$minTextSize = 15;
imagecolorallocate($image, 130,130,130);
$textcolor = imagecolorallocate($image, 0, 0, 0);

for($i=0; $i < 10; $i++)
	imageline($image, 0, rand(0,25), 100, rand(0,25), imagecolorallocate($image, 90,90,90));
for($i=0; $i < 25; $i++)
	imageline($image, rand(0,100), 0, rand(0,100), 20, imagecolorallocate($image, 190,190,190));

imagettftext($image, rand($maxTextSize,$minTextSize), rand(-30,40), 5, 15, $textcolor, $font, $text[0]);
imagettftext($image, rand($maxTextSize,$minTextSize), rand(-30,40), 21, 15, $textcolor, $font, $text[1]);
imagettftext($image, rand($maxTextSize,$minTextSize), rand(-30,40), 37, 15, $textcolor, $font, $text[2]);
imagettftext($image, rand($maxTextSize,$minTextSize), rand(-30,40), 53, 15, $textcolor, $font, $text[3]);
imagettftext($image, rand($maxTextSize,$minTextSize), rand(-30,40), 67, 15, $textcolor, $font, $text[4]);

header("Content-type: image/jpeg");
imagejpeg($image,'',90);
imagedestroy($image);
?>